package com.educate.handler;


import com.educate.pojo.response.ErrorResult;
import com.educate.pojo.response.ResultCode;
import org.springframework.http.HttpStatus;


import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;


/**
 * @author xiongyu
 * @date 2021/8/1 23:27
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    /**
     * 其他异常处理
     * @param e
     * @return
     */
    @ExceptionHandler({Throwable.class})
    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
    public ErrorResult bizExceptionHandler(Throwable e) {

        return ErrorResult.fail(ResultCode.ERROR,e);
    }

}
